<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {

    protected function _initDoctype() {
        $this->bootstrap('view');
        $view = $this->getResource('view');
        $view->doctype('XHTML1_STRICT');
    }

    public function run() {
        Zend_Registry::set('config', new Zend_Config($this->getOptions()));
        parent::run();
    }

    /**
     * Initialize Module
     *
     * @return Zend_Application_Module_Autoloader
     */
    protected function _initAutoload() {
        $loader = new Zend_Application_Module_Autoloader(array(
                    'namespace' => '',
                    'basePath' => APPLICATION_PATH));
        return $loader;
    }

    /**
     * Initialize data bases
     *
     * @return Zend_Db::factory
     */
    protected function _initDb() {

        $config = new Zend_Config($this->getOptions());
        try {
            $db = Zend_Db::factory($config->resources->db);
            $db->getConnection();
        } catch (Exception $e) {
            exit($e->getMessage());
        }
        Zend_Registry::set('dba', $db);
        Zend_Db_Table::setDefaultAdapter($db);
        return $db;
    }

}